OT: Pascal_ComPort

Otázka od: MarcelConka

20. 5. 2004 19:32

Sorry za OT.
Potreboval by som poradit ako v Pascale poslat na COM port nejaky retazec.
Dakujem.


Odpovedá: Slavomir Skopalik

20. 5. 2004 21:28

treba takto:

function TComThread.CreateHandle(const DeviceName: string): THandle;
begin
  Result := CreateFile(PCHAR(CheckComName(DeviceName)), GENERIC_READ or
GENERIC_WRITE,
                       0, nil, OPEN_EXISTING, 0, 0);
end;

a pak:

function TComThread.WriteData(const Data: string): Boolean;
var bw:cardinal;
begin
  Result := WriteFile(FComHandle,data[1],Length(data),bw,nil);
  Result := Result and (integer(bw)=Length(data));
end;

 Slavek

> -----Original Message-----
> From: delphi-l-owner@clexpert.cz
> [mailto:delphi-l-owner@clexpert.cz] On Behalf Of MarcelConka
> Sent: Thursday, May 20, 2004 7:30 PM
> To: delphi-l@clexpert.cz
> Subject: OT: Pascal_ComPort
>
>
> Sorry za OT.
> Potreboval by som poradit ako v Pascale poslat na COM port
> nejaky retazec. Dakujem.
>
>
>
>
>
>


Odpovedá: MarcelConka

20. 5. 2004 21:51


V Delphi to viem pomocou nejakej komponenty ale ja to potrebujem v urobit v
TurboPascale pod DOSom



--treba takto:

--function TComThread.CreateHandle(const DeviceName: string): THandle; begin
  Result := CreateFile(PCHAR(CheckComName(DeviceName)), GENERIC_READ or
------ GENERIC_WRITE,
                       0, nil, OPEN_EXISTING, 0, 0);
-- end;

--a pak:

--function TComThread.WriteData(const Data: string): Boolean;-
--var bw:cardinal;
--begin
  --Result := WriteFile(FComHandle,data[1],Length(data),bw,nil);
 -- Result := Result and (integer(bw)=Length(data));
--end;

-- Slavek

> -----Original Message-----
> From: delphi-l-owner@clexpert.cz
> [mailto:delphi-l-owner@clexpert.cz] On Behalf Of MarcelConka
> Sent: Thursday, May 20, 2004 7:30 PM
> To: delphi-l@clexpert.cz
> Subject: OT: Pascal_ComPort
>
>
> Sorry za OT.
> Potreboval by som poradit ako v Pascale poslat na COM port
> nejaky retazec. Dakujem.
>


Odpovedá: Jiri Virt

21. 5. 2004 8:39

procedure WritePortB(const wPort:Word;bValue:Byte);
begin
asm
mov dx,wPort
mov al,bValue
out dx, al
end;
end;

Jirka Virt


Odpovedá: Kratochvil Milan

21. 5. 2004 8:53

Drive jsem pouzival asyn32 od Variantu ale narychlo jsem ho nenasel a nevim zda
byl free, ale tenhle by mozna stal za vyzkouseni.
http://cactus.iico.uaslp.mx/~lalm/serial.html
Milan

>-----Original Message-----
>From: MarcelConka [mailto:marcelconka@zoznam.sk]
>Sent: Thursday, May 20, 2004 7:30 PM
>To: delphi-l@clexpert.cz
>Subject: OT: Pascal_ComPort


>Sorry za OT.
>Potreboval by som poradit ako v Pascale poslat na COM port nejaky retazec.
>Dakujem.